<?php
class UsersController extends AppController {

	var $uses = array('User');
	
	public function login() {
		$user = null;
		$user = $this->User->findByNameAndPasswordAndDeleted(
				$this->post('name'),
				$this->post('password'),
				DELETE_VALID
		);
		if($user) {
			$this->beginSession($user);
			$this->setResult(true, $user);
		} else {
			$this->setResult(true);
		}
	}
}